package org.hdax.dm.service.impl;

import org.hdax.dm.client.DmCinemaClient;
import org.hdax.dm.entity.cinema.DmCinema;
import org.hdax.dm.service.DmCinemaService;
import org.hdax.dm.vo.CommonResponse;
import org.hdax.dm.vo.VoUtil;
import org.hdax.dm.vo.entity.cinema.VoCinema;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class DmCinemaServiceImpl implements DmCinemaService {
    @Autowired
    private DmCinemaClient dmCinemaClient;



    @Override
    public CommonResponse<List<VoCinema>> queryCityList() {
        List<VoCinema> voCinemaList = new ArrayList<>();
        List<DmCinema> dmCinemaList = dmCinemaClient.findByDmCinema(new DmCinema());
        dmCinemaList.forEach(item -> {
            VoCinema voCinema = new VoCinema();
            voCinema.setId(item.getId());
            voCinema.setName(item.getAreaName());
            voCinemaList.add(voCinema);
        });
        return VoUtil.returnSuccess(voCinemaList);
    }

}
